import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.text.html.*;

public class ClientGUI extends JFrame 
{
    private TextField tf;
    private StyledDocument doc;
    private JTextPane tp;
    Client client;
    public ClientGUI(Client c)
    {
	client=c;
	setTitle("Magic Draft Client");
	setLayout(new BorderLayout());
	setSize(400, 400);
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	tf = new TextField();
	doc = new DefaultStyledDocument();
	tp = new JTextPane(doc);
	tp.setEditable(false);
	tf.addActionListener(client);
	add("North", tf);
	add("Center", tp);
	setVisible(true);
    }
    public void appendMessage(String message) throws Exception
    {
	doc.insertString (doc.getLength (), message + "\n", null);
    }
}
